<!--
  *********************物流项目三组************************
*  功能描述：货主合同跟踪
*  作者：黄启轩
*  时间：2022-02-10
*  修改人：黄启轩
*  修改时间：2022-02-10
*********************物流项目三组************************
-->
<template>
  <div>
    <!-- 查询 -->
    <div class="div0">
      <el-row :gutter="12">
        <el-col :span="7"
          >合同标题：<el-input
            v-model="ContractsTitle"
            placeholder="请输入内容"
            size="medium"
          ></el-input
        ></el-col>
        <el-col :span="7"
          >货主单位：<el-input
            v-model="ContractUnits"
            placeholder="请输入内容"
            size="medium"
          ></el-input
        ></el-col>
        <el-col :span="7"
          >货主负责人：<el-input
            v-model="ContractName"
            placeholder="请输入内容"
            size="medium"
          ></el-input
        ></el-col>
      </el-row>
      <el-row :gutter="12">
        <el-col :span="7"
          >经办人：<el-input
            v-model="ContractAttentionLine"
            placeholder="请输入内容"
            size="medium"
          ></el-input
        ></el-col>
        <el-col :span="7"
          >签订时间：<el-input
            v-model="ContractCreateDate"
            placeholder="请输入内容"
            size="medium"
          ></el-input
        ></el-col>

        <el-col :span="1.5"
          ><el-button type="primary" size="medium">查询</el-button></el-col
        >
        <el-col :span="1.5"><el-button size="medium">重置</el-button></el-col>
      </el-row>

      <el-row :gutter="12">
        <el-col :span="1"
          ><el-button type="primary" size="medium">删除</el-button></el-col
        >
      </el-row>
    </div>

    <!-- 分页显示 -->

    <div class="div1">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="Contract_Title" label="合同标题" width="120">
        </el-table-column>
        <el-table-column prop="Contract_Units" label="货主单位" width="120">
        </el-table-column>
        <el-table-column prop="Contract_Name" label="货主负责人" width="200">
        </el-table-column>
        <el-table-column prop="Contract_Line" label="线路" width="100">
        <template slot-scope="scope">
          <span v-show="scope.row.Contract_Line == 1">线路1</span>
          <span v-show="scope.row.Contract_Line == 2">线路2</span>
        </template>
      </el-table-column>
        <el-table-column prop="Contract_Price" label="吨运价" width="120">
        </el-table-column>
        <el-table-column prop="Contract_Chartered" label="包车条件吨位" width="120">
        </el-table-column>
        <el-table-column prop="Contract_balance" label="包车金额" width="120">
        </el-table-column>
        <el-table-column prop="Contract_CreateDate" label="签订日期" width="120">
        </el-table-column>
        <el-table-column prop="Contract_AttentionLine" label="经办人" width="120">
        </el-table-column>
        <el-table-column prop="CreateDate" label="创建时间" width="120">
        </el-table-column>

        <el-table-column fixed="right" label="操作" width="150">
          <template >
            <el-button  type="text" size="small" @click="tomap"
              >跟踪物流</el-button
            >
            <el-button type="text" size="small">编辑</el-button>
            <el-button type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div style="float: right; margin-top: 20px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageindex"
          :page-sizes="[1, 3, 5, 10]"
          :page-size="pagesize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pagetotal"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formLabelWidth: "120px",
      ContractsTitle: "",
      ContractUnits: "",
      ContractName: "",
      ContractAttentionLine: "",
      ContractCreateDate: "",
      ContractState: 0,
      pageindex: 1,
      pagesize: 5,
      tableData: [],
      pagetotal: 0,
    };
  },
  methods: {
    show() {
      this.$axios
        .get(
          "https://localhost:44360/api/app/t-mS_Contract/contracts?ContractsTitle=" +
            this.ContractsTitle +
            "&ContractUnits=" +
            this.ContractUnits +
            "&ContractName=" +
            this.ContractName +
            "&ContractAttentionLine=" +
            this.ContractAttentionLine +
            "&ContractCreateDate=" +
            this.ContractCreateDate +
            "&ContractState=" +
            this.ContractState +
            "&pageindex=" +
            this.pageindex +
            "&pagesize=" +
            this.pagesize +
            ""
        )
        .then((res) => {
          this.tableData = res.data.PageData;
          this.totalcount = res.data.PageTotal;
        });
    },
    handleSizeChange(val) {
      this.pagesize = val;
      this.show();
    },
    handleCurrentChange(val) {
      this.pageindex = val;
      this.show();
    },
    tomap(){   
      this.$router.push("/baidua");
    }
  },
  created() {
    this.show()
  },
  computed: {},
};
</script>
<style scoped>
.div0,
.div1 {
  margin-left: 1%;
  margin-top: 1%;
}
.el-row {
  margin-bottom: 20px;
}
.last-child {
  margin-bottom: 0;
}
.el-col {
  border-radius: 4px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
.el-input {
  width: 250px;
}
</style>
